package day04;

import java.util.Scanner;

public class ForDEmo {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入一个数");
        int num = sc.nextInt();
        int sum = 0;
        for (int i = 0;i<=num;i++){
            sum+=i;
        }
        System.out.println(sum);
        /*
                  sum=0
          i=1     sum=1
          i=2     sum=1+2
          i=3     sum=1+2+3
          i=4     sum=1+2+3+4
          ...     sum=1+2+3+4+...
          i=99    sum=1+2+3+4+...+99
          i=num   sum=1+2+3+4+...+99+num
          i=num+1   false
         */





        /*for (int i=0;i<5;i++){
            System.out.println("牛牛牛");
        }
        System.out.println("结束");*/
        /*
        0 t s
        1 t s
        2 t s
        3 t s
        4 t s
        5 f j

         */
        /*for (int i=1;i<=9;i++){
            System.out.println(i+"+9="+i*9);
        }
        for (int i=1;i<=9;i+=2){
            System.out.println(i+"+9="+i*9);
        }
        *//*
        1 t x
        3 t x
        5 t x
        7 t x
        9 t x
        11 f j
        *//*
        for (int i=9;i>=1;i--                              ){
            System.out.println(i+"+9="+i*9);
        }
        *//*
        1 t x
        2 t x
        3 t x
        4 t x
        5 t x
        6 t x
        7 t x
        8 t x
        9 t x
        10f j
        */
    }
}
